[packages/fuse-exfat] - rel 2; tiny fixes from svn
arekm
arekm at pld-linux.org
Sun May 5 10:38:23 CEST 2013
commit 68e2756a3f808ebe14b41efa5d950e4e05ffa181
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sun May 5 10:38:20 2013 +0200
- rel 2; tiny fixes from svn
exfat-svn-fuse.patch | 212 +++++++++++++++++++++++++++++++++++++++++++++++
exfat-svn-libexfat.patch | 122 +++++++++++++++++++++++++++
fuse-exfat.spec | 10 ++-
3 files changed, 343 insertions(+), 1 deletion(-)
---
diff --git a/fuse-exfat.spec b/fuse-exfat.spec
index 84a5c9c..08da885 100644
--- a/fuse-exfat.spec
+++ b/fuse-exfat.spec
@@ -2,12 +2,16 @@ Summary: FUSE module to access exFAT filesystem
Summary(pl.UTF-8): Moduł FUSE pozwalający na dostęp do systemu plików exFAT
Name: fuse-exfat
Version: 1.0.1
-Release: 1
+Release: 2
License: GPL v3+
Group: Applications/System
#Source0Download: http://code.google.com/p/exfat/downloads/list
Source0: http://exfat.googlecode.com/files/%{name}-%{version}.tar.gz
# Source0-md5: 7988a5111841593231f20af22153362d
+# svn diff -r342:HEAD http://exfat.googlecode.com/svn/trunk/fuse > exfat-svn-fuse.patch
+Patch0: exfat-svn-fuse.patch
+# svn diff -r342:HEAD http://exfat.googlecode.com/svn/trunk/libexfat > exfat-svn-libexfat.patch
+Patch1: exfat-svn-libexfat.patch
URL: http://code.google.com/p/exfat/
BuildRequires: libfuse-devel >= 2.6
BuildRequires: rpmbuild(macros) >= 1.385
@@ -26,6 +30,10 @@ moduł FUSE.
%prep
%setup -q
+cd fuse
+%patch0 -p0
+cd ../libexfat
+%patch1 -p0
%build
%scons
diff --git a/exfat-svn-fuse.patch b/exfat-svn-fuse.patch
new file mode 100644
index 0000000..bf0d195
--- /dev/null
+++ b/exfat-svn-fuse.patch
@@ -0,0 +1,212 @@
+Index: main.c
+===================================================================
+--- main.c (wersja 342)
++++ main.c (wersja 353)
+@@ -80,7 +80,7 @@
+ if (rc != 0)
+ return rc;
+
+- rc = exfat_truncate(&ef, node, size);
++ rc = exfat_truncate(&ef, node, size, true);
+ exfat_put_node(&ef, node);
+ return rc;
+ }
+@@ -242,15 +242,25 @@
+ return 0;
+ }
+
+-#ifdef __APPLE__
+ static int fuse_exfat_chmod(const char* path, mode_t mode)
+ {
++ const mode_t VALID_MODE_MASK = S_IFREG | S_IFDIR |
++ S_IRWXU | S_IRWXG | S_IRWXO;
++
+ exfat_debug("[%s] %s 0%ho", __func__, path, mode);
+- /* make OS X utilities happy */
++ if (mode & ~VALID_MODE_MASK)
++ return -EPERM;
+ return 0;
+ }
+-#endif
+
++static int fuse_exfat_chown(const char* path, uid_t uid, gid_t gid)
++{
++ exfat_debug("[%s] %s %u:%u", __func__, path, uid, gid);
++ if (uid != ef.uid || gid != ef.gid)
++ return -EPERM;
++ return 0;
++}
++
+ static int fuse_exfat_statfs(const char* path, struct statvfs* sfs)
+ {
+ exfat_debug("[%s]", __func__);
+@@ -292,7 +302,7 @@
+
+ static void usage(const char* prog)
+ {
+- fprintf(stderr, "Usage: %s [-d] [-o options] [-v] <device> <dir>\n", prog);
++ fprintf(stderr, "Usage: %s [-d] [-o options] [-V] <device> <dir>\n", prog);
+ exit(1);
+ }
+
+@@ -311,9 +321,8 @@
+ .mkdir = fuse_exfat_mkdir,
+ .rename = fuse_exfat_rename,
+ .utimens = fuse_exfat_utimens,
+-#ifdef __APPLE__
+ .chmod = fuse_exfat_chmod,
+-#endif
++ .chown = fuse_exfat_chown,
+ .statfs = fuse_exfat_statfs,
+ .init = fuse_exfat_init,
+ .destroy = fuse_exfat_destroy,
+@@ -344,21 +353,6 @@
+ return options;
+ }
+
+-static char* add_fsname_option(char* options, const char* spec)
+-{
+- char* spec_abs = realpath(spec, NULL);
+-
+- if (spec_abs == NULL)
+- {
+- free(options);
+- exfat_error("failed to get absolute path for `%s'", spec);
+- return NULL;
+- }
+- options = add_option(options, "fsname", spec_abs);
+- free(spec_abs);
+- return options;
+-}
+-
+ static char* add_user_option(char* options)
+ {
+ struct passwd* pw;
+@@ -390,7 +384,7 @@
+
+ static char* add_fuse_options(char* options, const char* spec)
+ {
+- options = add_fsname_option(options, spec);
++ options = add_option(options, "fsname", spec);
+ if (options == NULL)
+ return NULL;
+ options = add_user_option(options);
+@@ -413,7 +407,7 @@
+ int debug = 0;
+ struct fuse_chan* fc = NULL;
+ struct fuse* fh = NULL;
+- char** pp;
++ int opt;
+
+ printf("FUSE exfat %u.%u.%u\n",
+ EXFAT_VERSION_MAJOR, EXFAT_VERSION_MINOR, EXFAT_VERSION_PATCH);
+@@ -425,40 +419,39 @@
+ return 1;
+ }
+
+- for (pp = argv + 1; *pp; pp++)
++ while ((opt = getopt(argc, argv, "dno:Vv")) != -1)
+ {
+- if (strcmp(*pp, "-o") == 0)
++ switch (opt)
+ {
+- pp++;
+- if (*pp == NULL)
+- usage(argv[0]);
+- mount_options = add_option(mount_options, *pp, NULL);
++ case 'd':
++ debug = 1;
++ break;
++ case 'n':
++ break;
++ case 'o':
++ mount_options = add_option(mount_options, optarg, NULL);
+ if (mount_options == NULL)
+ return 1;
+- }
+- else if (strcmp(*pp, "-d") == 0)
+- debug = 1;
+- else if (strcmp(*pp, "-v") == 0)
+- {
++ break;
++ case 'V':
+ free(mount_options);
+ puts("Copyright (C) 2010-2013 Andrew Nayenko");
+ return 0;
+- }
+- else if (spec == NULL)
+- spec = *pp;
+- else if (mount_point == NULL)
+- mount_point = *pp;
+- else
+- {
++ case 'v':
++ break;
++ default:
+ free(mount_options);
+ usage(argv[0]);
++ break;
+ }
+ }
+- if (spec == NULL || mount_point == NULL)
++ if (argc - optind != 2)
+ {
+ free(mount_options);
+ usage(argv[0]);
+ }
++ spec = argv[optind];
++ mount_point = argv[optind + 1];
+
+ if (exfat_mount(&ef, spec, mount_options) != 0)
+ {
+Index: mount.exfat-fuse.8
+===================================================================
+--- mount.exfat-fuse.8 (wersja 342)
++++ mount.exfat-fuse.8 (wersja 353)
+@@ -9,10 +9,16 @@
+ .B \-d
+ ]
+ [
++.B \-n
++]
++[
+ .B \-o
+ .I options
+ ]
+ [
++.B \-V
++]
++[
+ .B \-v
+ ]
+ .I device dir
+@@ -21,7 +27,7 @@
+ .B mount.exfat-fuse
+ is a free exFAT file system implementation with write support. exFAT is a
+ simple file system created by Microsoft. It is intended to replace FAT32
+-removing some of it's limitations. exFAT is a standard FS for SDXC memory
++removing some of its limitations. exFAT is a standard FS for SDXC memory
+ cards.
+
+ .SH COMMAND LINE OPTIONS
+@@ -30,13 +36,19 @@
+ .BI \-d
+ Enable debug logging and do not detach from shell.
+ .TP
++.BI \-n
++Ignored.
++.TP
+ .BI \-o " options"
+ File system specific options. For more details see
+ .B FILE SYSTEM OPTIONS
+ section below.
+ .TP
++.BI \-V
++Print version and copyright.
++.TP
+ .BI \-v
+-Print version and copyright.
++Ignored.
+
+ .SH FILE SYSTEM OPTIONS
+ .TP
diff --git a/exfat-svn-libexfat.patch b/exfat-svn-libexfat.patch
new file mode 100644
index 0000000..4ebe69f
--- /dev/null
+++ b/exfat-svn-libexfat.patch
@@ -0,0 +1,122 @@
+Index: cluster.c
+===================================================================
+--- cluster.c (wersja 342)
++++ cluster.c (wersja 353)
+@@ -134,7 +134,7 @@
+ ef->cmap.dirty = false;
+ }
+
+-static void set_next_cluster(const struct exfat* ef, int contiguous,
++static void set_next_cluster(const struct exfat* ef, bool contiguous,
+ cluster_t current, cluster_t next)
+ {
+ off_t fat_offset;
+@@ -187,7 +187,7 @@
+ cluster_t c;
+
+ for (c = first; c < last; c++)
+- set_next_cluster(ef, 0, c, c + 1);
++ set_next_cluster(ef, false, c, c + 1);
+ }
+
+ static int shrink_file(struct exfat* ef, struct exfat_node* node,
+@@ -344,7 +344,8 @@
+ return 0;
+ }
+
+-int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size)
++int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size,
++ bool erase)
+ {
+ uint32_t c1 = bytes2clusters(ef, node->size);
+ uint32_t c2 = bytes2clusters(ef, size);
+@@ -364,9 +365,12 @@
+ if (rc != 0)
+ return rc;
+
+- rc = erase_range(ef, node, node->size, size);
+- if (rc != 0)
+- return rc;
++ if (erase)
++ {
++ rc = erase_range(ef, node, node->size, size);
++ if (rc != 0)
++ return rc;
++ }
+
+ exfat_update_mtime(node);
+ node->size = size;
+Index: node.c
+===================================================================
+--- node.c (wersja 342)
++++ node.c (wersja 353)
+@@ -56,7 +56,7 @@
+ if (node->flags & EXFAT_ATTRIB_UNLINKED)
+ {
+ /* free all clusters and node structure itself */
+- exfat_truncate(ef, node, 0);
++ exfat_truncate(ef, node, 0, true);
+ free(node);
+ }
+ if (ef->cmap.dirty)
+@@ -627,7 +627,7 @@
+ new_size = CLUSTER_SIZE(*ef->sb);
+ if (new_size == dir->size)
+ return 0;
+- rc = exfat_truncate(ef, dir, new_size);
++ rc = exfat_truncate(ef, dir, new_size, true);
+ if (rc != 0)
+ return rc;
+ return 0;
+@@ -673,7 +673,7 @@
+ {
+ return exfat_truncate(ef, dir,
+ DIV_ROUND_UP(asize + difference, CLUSTER_SIZE(*ef->sb))
+- * CLUSTER_SIZE(*ef->sb));
++ * CLUSTER_SIZE(*ef->sb), true);
+ }
+
+ static int find_slot(struct exfat* ef, struct exfat_node* dir,
+@@ -826,7 +826,7 @@
+ if (rc != 0)
+ return 0;
+ /* directories always have at least one cluster */
+- rc = exfat_truncate(ef, node, CLUSTER_SIZE(*ef->sb));
++ rc = exfat_truncate(ef, node, CLUSTER_SIZE(*ef->sb), true);
+ if (rc != 0)
+ {
+ delete(ef, node);
+Index: io.c
+===================================================================
+--- io.c (wersja 342)
++++ io.c (wersja 353)
+@@ -351,9 +351,12 @@
+ const char* bufp = buffer;
+ off_t lsize, loffset, remainder;
+
+- if (offset + size > node->size)
+- if (exfat_truncate(ef, node, offset + size) != 0)
+- return -1;
++ if (offset > node->size)
++ if (exfat_truncate(ef, node, offset, true) != 0)
++ return -1;
++ if (offset + size > node->size)
++ if (exfat_truncate(ef, node, offset + size, false) != 0)
++ return -1;
+ if (size == 0)
+ return 0;
+
+Index: exfat.h
+===================================================================
+--- exfat.h (wersja 342)
++++ exfat.h (wersja 353)
+@@ -164,7 +164,8 @@
+ cluster_t exfat_advance_cluster(const struct exfat* ef,
+ struct exfat_node* node, uint32_t count);
+ void exfat_flush_cmap(struct exfat* ef);
+-int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size);
++int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size,
++ bool erase);
+ uint32_t exfat_count_free_clusters(const struct exfat* ef);
+ int exfat_find_used_sectors(const struct exfat* ef, off_t* a, off_t* b);
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/fuse-exfat.git/commitdiff/68e2756a3f808ebe14b41efa5d950e4e05ffa181
More information about the pld-cvs-commit
mailing list