* vfs.h: Constify some arguments for many functions.
* xdirentry.h: Likewise. Adjust all dependencies.
Этот коммит содержится в:
родитель
5bc20fd294
Коммит
7d16d65e35
@ -1,5 +1,8 @@
|
||||
2003-10-27 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* vfs.h: Constify some arguments for many functions.
|
||||
* xdirentry.h: Likewise. Adjust all dependencies.
|
||||
|
||||
* *.c: Rename functions that don't have an a prefix indicating
|
||||
what file they are defined in. This simplifies debugging.
|
||||
|
||||
|
15
vfs/cpio.c
15
vfs/cpio.c
@ -129,7 +129,9 @@ static void cpio_free_archive(struct vfs_class *me, struct vfs_s_super *super)
|
||||
mc_close(super->u.arch.fd);
|
||||
}
|
||||
|
||||
static int cpio_open_cpio_file(struct vfs_class *me, struct vfs_s_super *super, char *name)
|
||||
static int
|
||||
cpio_open_cpio_file (struct vfs_class *me, struct vfs_s_super *super,
|
||||
const char *name)
|
||||
{
|
||||
int fd, type;
|
||||
mode_t mode;
|
||||
@ -505,7 +507,9 @@ cpio_create_entry (struct vfs_class *me, struct vfs_s_super *super,
|
||||
|
||||
/* Need to CPIO_SEEK_CUR to skip the file at the end of add entry!!!! */
|
||||
|
||||
static int cpio_open_archive(struct vfs_class *me, struct vfs_s_super *super, char *name, char *op)
|
||||
static int
|
||||
cpio_open_archive (struct vfs_class *me, struct vfs_s_super *super,
|
||||
const char *name, char *op)
|
||||
{
|
||||
int status = STATUS_START;
|
||||
|
||||
@ -531,7 +535,8 @@ static int cpio_open_archive(struct vfs_class *me, struct vfs_s_super *super, ch
|
||||
}
|
||||
|
||||
/* Remaining functions are exactly same as for tarfs (and were in fact just copied) */
|
||||
static void *cpio_super_check(struct vfs_class *me, char *archive_name, char *op)
|
||||
static void *
|
||||
cpio_super_check (struct vfs_class *me, const char *archive_name, char *op)
|
||||
{
|
||||
static struct stat sb;
|
||||
if (mc_stat (archive_name, &sb))
|
||||
@ -540,8 +545,8 @@ static void *cpio_super_check(struct vfs_class *me, char *archive_name, char *op
|
||||
}
|
||||
|
||||
static int
|
||||
cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc, char *archive_name,
|
||||
char *op, void *cookie)
|
||||
cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc,
|
||||
const char *archive_name, char *op, void *cookie)
|
||||
{
|
||||
struct stat *archive_stat = cookie; /* stat of main archive */
|
||||
|
||||
|
@ -420,7 +420,8 @@ vfs_s_free_super (struct vfs_class *me, struct vfs_s_super *super)
|
||||
/* ------------------------------------------------------------------------= */
|
||||
|
||||
static void
|
||||
vfs_s_stamp_me (struct vfs_class *me, struct vfs_s_super *psup, char *fs_name)
|
||||
vfs_s_stamp_me (struct vfs_class *me, struct vfs_s_super *psup,
|
||||
const char *fs_name)
|
||||
{
|
||||
struct vfs_stamping *parent;
|
||||
struct vfs_class *v;
|
||||
@ -438,9 +439,11 @@ vfs_s_stamp_me (struct vfs_class *me, struct vfs_s_super *psup, char *fs_name)
|
||||
}
|
||||
|
||||
char *
|
||||
vfs_s_get_path_mangle (struct vfs_class *me, char *inname, struct vfs_s_super **archive, int flags)
|
||||
vfs_s_get_path_mangle (struct vfs_class *me, const char *inname,
|
||||
struct vfs_s_super **archive, int flags)
|
||||
{
|
||||
char *local, *op, *archive_name;
|
||||
char *local, *op;
|
||||
const char *archive_name;
|
||||
int result = -1;
|
||||
struct vfs_s_super *super;
|
||||
void *cookie = NULL;
|
||||
@ -455,10 +458,14 @@ vfs_s_get_path_mangle (struct vfs_class *me, char *inname, struct vfs_s_super **
|
||||
return NULL;
|
||||
|
||||
for (super = MEDATA->supers; super != NULL; super = super->next) {
|
||||
int i; /* 0 == other, 1 == same, return it, 2 == other but stop scanning */
|
||||
if ((i = MEDATA->archive_same (me, super, archive_name, op, cookie))){
|
||||
if (i==1) goto return_success;
|
||||
else break;
|
||||
/* 0 == other, 1 == same, return it, 2 == other but stop scanning */
|
||||
int i;
|
||||
if ((i =
|
||||
MEDATA->archive_same (me, super, archive_name, op, cookie))) {
|
||||
if (i == 1)
|
||||
goto return_success;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,7 +543,7 @@ vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
/* ------------------------ readdir & friends ----------------------------- */
|
||||
|
||||
static struct vfs_s_inode *
|
||||
vfs_s_inode_from_path (struct vfs_class *me, char *name, int flags)
|
||||
vfs_s_inode_from_path (struct vfs_class *me, const char *name, int flags)
|
||||
{
|
||||
struct vfs_s_super *super;
|
||||
struct vfs_s_inode *ino;
|
||||
@ -684,7 +691,7 @@ vfs_s_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
||||
}
|
||||
|
||||
static void *
|
||||
vfs_s_open (struct vfs_class *me, char *file, int flags, int mode)
|
||||
vfs_s_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
{
|
||||
int was_changed = 0;
|
||||
struct vfs_s_fh *fh;
|
||||
@ -740,7 +747,8 @@ vfs_s_open (struct vfs_class *me, char *file, int flags, int mode)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else if ((MEDATA->fh_open) && (MEDATA->fh_open (me, fh, flags, mode))){
|
||||
} else if ((MEDATA->fh_open)
|
||||
&& (MEDATA->fh_open (me, fh, flags, mode))) {
|
||||
g_free (fh);
|
||||
return NULL;
|
||||
}
|
||||
@ -959,16 +967,13 @@ vfs_s_ferrno (struct vfs_class *me)
|
||||
}
|
||||
|
||||
static char *
|
||||
vfs_s_getlocalcopy (struct vfs_class *me, char *path)
|
||||
vfs_s_getlocalcopy (struct vfs_class *me, const char *path)
|
||||
{
|
||||
struct vfs_s_inode *ino;
|
||||
char buf[MC_MAXPATHLEN];
|
||||
|
||||
strncpy (buf, path, MC_MAXPATHLEN);
|
||||
ino = vfs_s_inode_from_path (me, path, FL_FOLLOW | FL_NONE);
|
||||
|
||||
if (!ino->localname)
|
||||
ino->localname = mc_def_getlocalcopy (me, buf);
|
||||
ino->localname = mc_def_getlocalcopy (me, path);
|
||||
/* FIXME: fd_usage++ missing */
|
||||
return g_strdup (ino->localname);
|
||||
}
|
||||
|
33
vfs/extfs.c
33
vfs/extfs.c
@ -199,7 +199,7 @@ static void extfs_free_archive (struct archive *archive)
|
||||
}
|
||||
|
||||
static FILE *
|
||||
extfs_open_archive (int fstype, char *name, struct archive **pparc)
|
||||
extfs_open_archive (int fstype, const char *name, struct archive **pparc)
|
||||
{
|
||||
static dev_t __extfs_no = 0;
|
||||
FILE *result;
|
||||
@ -242,7 +242,7 @@ extfs_open_archive (int fstype, char *name, struct archive **pparc)
|
||||
|
||||
current_archive = g_new (struct archive, 1);
|
||||
current_archive->fstype = fstype;
|
||||
current_archive->name = name ? g_strdup (name) : name;
|
||||
current_archive->name = name ? g_strdup (name) : NULL;
|
||||
current_archive->local_name = local_name;
|
||||
|
||||
if (local_name != NULL)
|
||||
@ -279,14 +279,15 @@ extfs_open_archive (int fstype, char *name, struct archive **pparc)
|
||||
* Return 0 on success, -1 on error.
|
||||
*/
|
||||
static int
|
||||
extfs_read_archive (int fstype, char *name, struct archive **pparc)
|
||||
extfs_read_archive (int fstype, const char *name, struct archive **pparc)
|
||||
{
|
||||
FILE *extfsd;
|
||||
char *buffer;
|
||||
struct archive *current_archive;
|
||||
char *current_file_name, *current_link_name;
|
||||
|
||||
if ((extfsd = extfs_open_archive (fstype, name, ¤t_archive)) == NULL) {
|
||||
if ((extfsd =
|
||||
extfs_open_archive (fstype, name, ¤t_archive)) == NULL) {
|
||||
message (1, MSG_ERROR, _("Cannot open %s archive\n%s"),
|
||||
extfs_prefixes[fstype], name);
|
||||
return -1;
|
||||
@ -320,7 +321,9 @@ extfs_read_archive (int fstype, char *name, struct archive **pparc)
|
||||
if (S_ISDIR (hstat.st_mode)
|
||||
&& (!strcmp (p, ".") || !strcmp (p, "..")))
|
||||
goto read_extfs_continue;
|
||||
pent = extfs_find_entry (current_archive->root_entry, q, 1, 0);
|
||||
pent =
|
||||
extfs_find_entry (current_archive->root_entry, q, 1,
|
||||
0);
|
||||
if (pent == NULL) {
|
||||
/* FIXME: Should clean everything one day */
|
||||
g_free (buffer);
|
||||
@ -412,10 +415,11 @@ extfs_read_archive (int fstype, char *name, struct archive **pparc)
|
||||
* mangled by this operation (so you must not free its return value).
|
||||
*/
|
||||
static char *
|
||||
extfs_get_path_mangle (char *inname, struct archive **archive, int is_dir,
|
||||
int do_not_open)
|
||||
extfs_get_path_mangle (const char *inname, struct archive **archive,
|
||||
int is_dir, int do_not_open)
|
||||
{
|
||||
char *local, *archive_name, *op;
|
||||
char *local, *op;
|
||||
const char *archive_name;
|
||||
int result = -1;
|
||||
struct archive *parc;
|
||||
struct vfs_stamping *parent;
|
||||
@ -448,7 +452,9 @@ extfs_get_path_mangle (char *inname, struct archive **archive, int is_dir,
|
||||
}
|
||||
}
|
||||
|
||||
result = do_not_open ? -1 : extfs_read_archive (fstype, archive_name, &parc);
|
||||
result =
|
||||
do_not_open ? -1 : extfs_read_archive (fstype, archive_name,
|
||||
&parc);
|
||||
if (result == -1)
|
||||
ERRNOR (EIO, NULL);
|
||||
|
||||
@ -642,7 +648,7 @@ extfs_run (char *file)
|
||||
}
|
||||
|
||||
static void *
|
||||
extfs_open (struct vfs_class *me, char *file, int flags, int mode)
|
||||
extfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
{
|
||||
struct pseudofile *extfs_info;
|
||||
struct archive *archive;
|
||||
@ -1228,7 +1234,8 @@ static void extfs_free (vfsid id)
|
||||
extfs_free_archive (archive);
|
||||
}
|
||||
|
||||
static char *extfs_getlocalcopy (struct vfs_class *me, char *path)
|
||||
static char *
|
||||
extfs_getlocalcopy (struct vfs_class *me, const char *path)
|
||||
{
|
||||
struct pseudofile *fp =
|
||||
(struct pseudofile *) extfs_open (me, path, O_RDONLY, 0);
|
||||
@ -1246,7 +1253,9 @@ static char *extfs_getlocalcopy (struct vfs_class *me, char *path)
|
||||
return p;
|
||||
}
|
||||
|
||||
static int extfs_ungetlocalcopy (struct vfs_class *me, char *path, char *local, int has_changed)
|
||||
static int
|
||||
extfs_ungetlocalcopy (struct vfs_class *me, const char *path, char *local,
|
||||
int has_changed)
|
||||
{
|
||||
struct pseudofile *fp =
|
||||
(struct pseudofile *) extfs_open (me, path, O_RDONLY, 0);
|
||||
|
17
vfs/fish.c
17
vfs/fish.c
@ -306,12 +306,14 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
|
||||
}
|
||||
|
||||
static int
|
||||
fish_open_archive (struct vfs_class *me, struct vfs_s_super *super, char *archive_name, char *op)
|
||||
fish_open_archive (struct vfs_class *me, struct vfs_s_super *super,
|
||||
const char *archive_name, char *op)
|
||||
{
|
||||
char *host, *user, *password, *p;
|
||||
int flags;
|
||||
|
||||
p = vfs_split_url (strchr(op, ':')+1, &host, &user, &flags, &password, 0, URL_NOSLASH);
|
||||
p = vfs_split_url (strchr (op, ':') + 1, &host, &user, &flags,
|
||||
&password, 0, URL_NOSLASH);
|
||||
|
||||
if (p)
|
||||
g_free (p);
|
||||
@ -328,19 +330,20 @@ fish_open_archive (struct vfs_class *me, struct vfs_s_super *super, char *archiv
|
||||
}
|
||||
|
||||
static int
|
||||
fish_archive_same(struct vfs_class *me, struct vfs_s_super *super, char *archive_name, char *op, void *cookie)
|
||||
fish_archive_same (struct vfs_class *me, struct vfs_s_super *super,
|
||||
const char *archive_name, char *op, void *cookie)
|
||||
{
|
||||
char *host, *user;
|
||||
int flags;
|
||||
|
||||
op = vfs_split_url (strchr(op, ':')+1, &host, &user, &flags, 0, 0, URL_NOSLASH);
|
||||
op = vfs_split_url (strchr (op, ':') + 1, &host, &user, &flags, 0, 0,
|
||||
URL_NOSLASH);
|
||||
|
||||
if (op)
|
||||
g_free (op);
|
||||
|
||||
flags = ((strcmp (host, SUP.host) == 0) &&
|
||||
(strcmp (user, SUP.user) == 0) &&
|
||||
(flags == SUP.flags));
|
||||
flags = ((strcmp (host, SUP.host) == 0)
|
||||
&& (strcmp (user, SUP.user) == 0) && (flags == SUP.flags));
|
||||
g_free (host);
|
||||
g_free (user);
|
||||
|
||||
|
@ -741,7 +741,8 @@ ftpfs_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
|
||||
}
|
||||
|
||||
static int
|
||||
ftpfs_open_archive (struct vfs_class *me, struct vfs_s_super *super, char *archive_name, char *op)
|
||||
ftpfs_open_archive (struct vfs_class *me, struct vfs_s_super *super,
|
||||
const char *archive_name, char *op)
|
||||
{
|
||||
char *host, *user, *password;
|
||||
int port;
|
||||
@ -761,14 +762,16 @@ ftpfs_open_archive (struct vfs_class *me, struct vfs_s_super *super, char *archi
|
||||
SUP.isbinary = TYPE_UNKNOWN;
|
||||
SUP.remote_is_amiga = 0;
|
||||
super->name = g_strdup ("/");
|
||||
super->root = vfs_s_new_inode (me, super, vfs_s_default_stat(me, S_IFDIR | 0755));
|
||||
super->root =
|
||||
vfs_s_new_inode (me, super,
|
||||
vfs_s_default_stat (me, S_IFDIR | 0755));
|
||||
|
||||
return ftpfs_open_archive_int (me, super);
|
||||
}
|
||||
|
||||
static int
|
||||
ftpfs_archive_same (struct vfs_class *me, struct vfs_s_super *super,
|
||||
char *archive_name, char *op, void *cookie)
|
||||
const char *archive_name, char *op, void *cookie)
|
||||
{
|
||||
char *host, *user;
|
||||
int port;
|
||||
|
@ -19,7 +19,7 @@
|
||||
static struct vfs_class vfs_local_ops;
|
||||
|
||||
static void *
|
||||
local_open (struct vfs_class *me, char *file, int flags, int mode)
|
||||
local_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
{
|
||||
int *local_info;
|
||||
int fd;
|
||||
@ -249,13 +249,14 @@ local_free (vfsid id)
|
||||
}
|
||||
|
||||
static char *
|
||||
local_getlocalcopy (struct vfs_class *me, char *path)
|
||||
local_getlocalcopy (struct vfs_class *me, const char *path)
|
||||
{
|
||||
return g_strdup (path);
|
||||
}
|
||||
|
||||
static int
|
||||
local_ungetlocalcopy (struct vfs_class *me, char *path, char *local, int has_changed)
|
||||
local_ungetlocalcopy (struct vfs_class *me, const char *path, char *local,
|
||||
int has_changed)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
10
vfs/mcfs.c
10
vfs/mcfs.c
@ -83,7 +83,7 @@ static struct vfs_class vfs_mcfs_ops;
|
||||
/* Extract the hostname and username from the path */
|
||||
/* path is in the form: hostname:user/remote-dir */
|
||||
static char *
|
||||
mcfs_get_host_and_username (char *path, char **host, char **user,
|
||||
mcfs_get_host_and_username (const char *path, char **host, char **user,
|
||||
int *port, char **pass)
|
||||
{
|
||||
return vfs_split_url (path, host, user, port, pass, 0, 0);
|
||||
@ -361,7 +361,7 @@ mcfs_set_error (int result, int errno_num)
|
||||
}
|
||||
|
||||
static char *
|
||||
mcfs_get_path (mcfs_connection **mc, char *path)
|
||||
mcfs_get_path (mcfs_connection **mc, const char *path)
|
||||
{
|
||||
char *user, *host, *remote_path;
|
||||
char *pass;
|
||||
@ -510,7 +510,7 @@ mcfs_gethome (mcfs_connection *mc)
|
||||
|
||||
/* The callbacks */
|
||||
static void *
|
||||
mcfs_open (struct vfs_class *me, char *file, int flags, int mode)
|
||||
mcfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
{
|
||||
char *remote_file;
|
||||
mcfs_connection *mc;
|
||||
@ -520,8 +520,8 @@ mcfs_open (struct vfs_class *me, char *file, int flags, int mode)
|
||||
if (!(remote_file = mcfs_get_path (&mc, file)))
|
||||
return 0;
|
||||
|
||||
rpc_send (mc->sock, RPC_INT, MC_OPEN, RPC_STRING, remote_file,
|
||||
RPC_INT, flags, RPC_INT, mode, RPC_END);
|
||||
rpc_send (mc->sock, RPC_INT, MC_OPEN, RPC_STRING, remote_file, RPC_INT,
|
||||
flags, RPC_INT, mode, RPC_END);
|
||||
g_free (remote_file);
|
||||
|
||||
if (0 ==
|
||||
|
44
vfs/sfs.c
44
vfs/sfs.c
@ -43,12 +43,14 @@ static int sfs_flags[ MAXFS ];
|
||||
#define F_NOLOCALCOPY 4
|
||||
#define F_FULLMATCH 8
|
||||
|
||||
static int sfs_uptodate (char *name, char *cache)
|
||||
static int
|
||||
sfs_uptodate (char *name, char *cache)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int sfs_vfmake (struct vfs_class *me, char *name, char *cache)
|
||||
static int
|
||||
sfs_vfmake (struct vfs_class *me, const char *name, char *cache)
|
||||
{
|
||||
char *inpath, *op;
|
||||
int w;
|
||||
@ -60,7 +62,9 @@ static int sfs_vfmake (struct vfs_class *me, char *name, char *cache)
|
||||
if ((w = (*me->which) (me, op)) == -1)
|
||||
vfs_die ("This cannot happen... Hopefully.\n");
|
||||
|
||||
if ((sfs_flags[w] & F_1) || (!strcmp (name, "/"))) ; else return -1;
|
||||
if ((sfs_flags[w] & F_1) || (!strcmp (name, "/")));
|
||||
else
|
||||
return -1;
|
||||
/* if ((sfs_flags[w] & F_2) || (!inpath) || (!*inpath)); else return -1; */
|
||||
if (!(sfs_flags[w] & F_NOLOCALCOPY)) {
|
||||
s = mc_getlocalcopy (name);
|
||||
@ -70,19 +74,27 @@ static int sfs_vfmake (struct vfs_class *me, char *name, char *cache)
|
||||
g_free (s);
|
||||
} else
|
||||
name = name_quote (name, 0);
|
||||
#define COPY_CHAR if (t-pad>sizeof(pad)) { g_free (name); return -1; } else *t++ = *s;
|
||||
#define COPY_STRING(a) if ((t-pad)+strlen(a)>sizeof(pad)) { g_free (name); return -1; } else { strcpy (t, a); t+= strlen(a); }
|
||||
#define COPY_CHAR if (t-pad>sizeof(pad)) { return -1; } else *t++ = *s;
|
||||
#define COPY_STRING(a) if ((t-pad)+strlen(a)>sizeof(pad)) { return -1; } else { strcpy (t, a); t+= strlen(a); }
|
||||
for (s = sfs_command[w]; *s; s++) {
|
||||
if (was_percent) {
|
||||
|
||||
char *ptr = NULL;
|
||||
const char *ptr = NULL;
|
||||
was_percent = 0;
|
||||
|
||||
switch (*s) {
|
||||
case '1': ptr = name; break;
|
||||
case '2': ptr = op + strlen (sfs_prefix[w]); break;
|
||||
case '3': ptr = cache; break;
|
||||
case '%': COPY_CHAR; continue;
|
||||
case '1':
|
||||
ptr = name;
|
||||
break;
|
||||
case '2':
|
||||
ptr = op + strlen (sfs_prefix[w]);
|
||||
break;
|
||||
case '3':
|
||||
ptr = cache;
|
||||
break;
|
||||
case '%':
|
||||
COPY_CHAR;
|
||||
continue;
|
||||
}
|
||||
COPY_STRING (ptr);
|
||||
} else {
|
||||
@ -92,7 +104,6 @@ static int sfs_vfmake (struct vfs_class *me, char *name, char *cache)
|
||||
COPY_CHAR;
|
||||
}
|
||||
}
|
||||
g_free (name);
|
||||
|
||||
open_error_pipe ();
|
||||
if (my_system (EXECUTE_AS_SHELL, "/bin/sh", pad)) {
|
||||
@ -105,7 +116,7 @@ static int sfs_vfmake (struct vfs_class *me, char *name, char *cache)
|
||||
}
|
||||
|
||||
static char *
|
||||
sfs_redirect (struct vfs_class *me, char *name)
|
||||
sfs_redirect (struct vfs_class *me, const char *name)
|
||||
{
|
||||
struct cachedfile *cur = head;
|
||||
char *cache;
|
||||
@ -146,7 +157,7 @@ sfs_redirect (struct vfs_class *me, char *name)
|
||||
}
|
||||
|
||||
static void *
|
||||
sfs_open (struct vfs_class *me, char *path, int flags, int mode)
|
||||
sfs_open (struct vfs_class *me, const char *path, int flags, int mode)
|
||||
{
|
||||
int *sfs_info;
|
||||
int fd;
|
||||
@ -282,13 +293,16 @@ static int sfs_nothingisopen (vfsid id)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char *sfs_getlocalcopy (struct vfs_class *me, char *path)
|
||||
static char *
|
||||
sfs_getlocalcopy (struct vfs_class *me, const char *path)
|
||||
{
|
||||
path = sfs_redirect (me, path);
|
||||
return g_strdup (path);
|
||||
}
|
||||
|
||||
static int sfs_ungetlocalcopy (struct vfs_class *me, char *path, char *local, int has_changed)
|
||||
static int
|
||||
sfs_ungetlocalcopy (struct vfs_class *me, const char *path, char *local,
|
||||
int has_changed)
|
||||
{
|
||||
g_free (local);
|
||||
return 0;
|
||||
|
@ -1791,7 +1791,7 @@ smbfs_open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int m
|
||||
}
|
||||
|
||||
static void *
|
||||
smbfs_open (struct vfs_class *me, char *file, int flags, int mode)
|
||||
smbfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
{
|
||||
char *remote_file, *p;
|
||||
void *ret;
|
||||
|
24
vfs/tar.c
24
vfs/tar.c
@ -198,7 +198,9 @@ static void tar_free_archive (struct vfs_class *me, struct vfs_s_super *archive)
|
||||
static int current_tar_position = 0;
|
||||
|
||||
/* Returns fd of the open tar file */
|
||||
static int tar_tar_open_archive (struct vfs_class *me, char *name, struct vfs_s_super *archive)
|
||||
static int
|
||||
tar_open_archive_int (struct vfs_class *me, const char *name,
|
||||
struct vfs_s_super *archive)
|
||||
{
|
||||
int result, type;
|
||||
mode_t mode;
|
||||
@ -231,9 +233,12 @@ static int tar_tar_open_archive (struct vfs_class *me, char *name, struct vfs_s_
|
||||
|
||||
archive->u.arch.fd = result;
|
||||
mode = archive->u.arch.st.st_mode & 07777;
|
||||
if (mode & 0400) mode |= 0100;
|
||||
if (mode & 0040) mode |= 0010;
|
||||
if (mode & 0004) mode |= 0001;
|
||||
if (mode & 0400)
|
||||
mode |= 0100;
|
||||
if (mode & 0040)
|
||||
mode |= 0010;
|
||||
if (mode & 0004)
|
||||
mode |= 0001;
|
||||
mode |= S_IFDIR;
|
||||
|
||||
root = vfs_s_new_inode (me, archive, &archive->u.arch.st);
|
||||
@ -514,7 +519,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive, int tard)
|
||||
*/
|
||||
static int
|
||||
tar_open_archive (struct vfs_class *me, struct vfs_s_super *archive,
|
||||
char *name, char *op)
|
||||
const char *name, char *op)
|
||||
{
|
||||
/* Initial status at start of archive */
|
||||
ReadStatus status = STATUS_EOFMARK;
|
||||
@ -523,7 +528,7 @@ tar_open_archive (struct vfs_class *me, struct vfs_s_super *archive,
|
||||
|
||||
current_tar_position = 0;
|
||||
/* Open for reading */
|
||||
if ((tard = tar_tar_open_archive (me, name, archive)) == -1)
|
||||
if ((tard = tar_open_archive_int (me, name, archive)) == -1)
|
||||
return -1;
|
||||
|
||||
for (;;) {
|
||||
@ -580,7 +585,8 @@ tar_open_archive (struct vfs_class *me, struct vfs_s_super *archive,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *tar_super_check(struct vfs_class *me, char *archive_name, char *op)
|
||||
static void *
|
||||
tar_super_check (struct vfs_class *me, const char *archive_name, char *op)
|
||||
{
|
||||
static struct stat stat_buf;
|
||||
if (mc_stat (archive_name, &stat_buf))
|
||||
@ -589,8 +595,8 @@ static void *tar_super_check(struct vfs_class *me, char *archive_name, char *op)
|
||||
}
|
||||
|
||||
static int
|
||||
tar_super_same (struct vfs_class *me, struct vfs_s_super *parc, char *archive_name,
|
||||
char *op, void *cookie)
|
||||
tar_super_same (struct vfs_class *me, struct vfs_s_super *parc,
|
||||
const char *archive_name, char *op, void *cookie)
|
||||
{
|
||||
struct stat *archive_stat = cookie; /* stat of main archive */
|
||||
|
||||
|
@ -380,7 +380,7 @@ typedef struct {
|
||||
|
||||
/* We do not support lseek */
|
||||
static void *
|
||||
undelfs_open (struct vfs_class *me, char *fname, int flags, int mode)
|
||||
undelfs_open (struct vfs_class *me, const char *fname, int flags, int mode)
|
||||
{
|
||||
char *file, *f;
|
||||
ext2_ino_t inode, i;
|
||||
@ -392,7 +392,8 @@ undelfs_open (struct vfs_class *me, char *fname, int flags, int mode)
|
||||
return 0;
|
||||
|
||||
if (!ext2_fname || strcmp (ext2_fname, file)) {
|
||||
message (1, undelfserr, _(" You have to chdir to extract files first "));
|
||||
message (1, undelfserr,
|
||||
_(" You have to chdir to extract files first "));
|
||||
g_free (file);
|
||||
g_free (f);
|
||||
return 0;
|
||||
|
@ -1008,9 +1008,10 @@ mc_munmap (caddr_t addr, size_t len)
|
||||
#endif
|
||||
|
||||
char *
|
||||
mc_def_getlocalcopy (struct vfs_class *vfs, char *filename)
|
||||
mc_def_getlocalcopy (struct vfs_class *vfs, const char *filename)
|
||||
{
|
||||
char *tmp, *suffix, *basename;
|
||||
char *tmp, *suffix;
|
||||
const char *basename;
|
||||
int fdin, fdout, i;
|
||||
char buffer[8192];
|
||||
struct stat mystat;
|
||||
@ -1079,8 +1080,8 @@ mc_getlocalcopy (const char *pathname)
|
||||
}
|
||||
|
||||
int
|
||||
mc_def_ungetlocalcopy (struct vfs_class *vfs, char *filename, char *local,
|
||||
int has_changed)
|
||||
mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
||||
char *local, int has_changed)
|
||||
{
|
||||
int fdin = -1, fdout = -1, i;
|
||||
if (has_changed) {
|
||||
|
31
vfs/vfs.h
31
vfs/vfs.h
@ -34,7 +34,8 @@ struct vfs_class {
|
||||
|
||||
int (*which) (struct vfs_class *me, char *path);
|
||||
|
||||
void *(*open) (struct vfs_class *me, char *fname, int flags, int mode);
|
||||
void *(*open) (struct vfs_class *me, const char *fname, int flags,
|
||||
int mode);
|
||||
int (*close) (void *vfs_info);
|
||||
int (*read) (void *vfs_info, char *buffer, int count);
|
||||
int (*write) (void *vfs_info, char *buf, int count);
|
||||
@ -49,9 +50,11 @@ struct vfs_class {
|
||||
|
||||
int (*chmod) (struct vfs_class *me, char *path, int mode);
|
||||
int (*chown) (struct vfs_class *me, char *path, int owner, int group);
|
||||
int (*utime) (struct vfs_class *me, char *path, struct utimbuf * times);
|
||||
int (*utime) (struct vfs_class *me, char *path,
|
||||
struct utimbuf * times);
|
||||
|
||||
int (*readlink) (struct vfs_class *me, char *path, char *buf, int size);
|
||||
int (*readlink) (struct vfs_class *me, char *path, char *buf,
|
||||
int size);
|
||||
int (*symlink) (struct vfs_class *me, char *n1, char *n2);
|
||||
int (*link) (struct vfs_class *me, char *p1, char *p2);
|
||||
int (*unlink) (struct vfs_class *me, char *path);
|
||||
@ -67,19 +70,21 @@ struct vfs_class {
|
||||
int (*nothingisopen) (vfsid id);
|
||||
void (*free) (vfsid id);
|
||||
|
||||
char *(*getlocalcopy) (struct vfs_class *me, char *filename);
|
||||
int (*ungetlocalcopy) (struct vfs_class *me, char *filename, char *local,
|
||||
int has_changed);
|
||||
char *(*getlocalcopy) (struct vfs_class *me, const char *filename);
|
||||
int (*ungetlocalcopy) (struct vfs_class *me, const char *filename,
|
||||
char *local, int has_changed);
|
||||
|
||||
int (*mkdir) (struct vfs_class *me, char *path, mode_t mode);
|
||||
int (*rmdir) (struct vfs_class *me, char *path);
|
||||
|
||||
int (*ctl) (void *vfs_info, int ctlop, void *arg);
|
||||
int (*setctl) (struct vfs_class *me, char *path, int ctlop, void *arg);
|
||||
int (*setctl) (struct vfs_class *me, char *path, int ctlop,
|
||||
void *arg);
|
||||
#ifdef HAVE_MMAP
|
||||
caddr_t (*mmap) (struct vfs_class *me, caddr_t addr, size_t len, int prot,
|
||||
int flags, void *vfs_info, off_t offset);
|
||||
int (*munmap) (struct vfs_class *me, caddr_t addr, size_t len, void *vfs_info);
|
||||
caddr_t (*mmap) (struct vfs_class *me, caddr_t addr, size_t len,
|
||||
int prot, int flags, void *vfs_info, off_t offset);
|
||||
int (*munmap) (struct vfs_class *me, caddr_t addr, size_t len,
|
||||
void *vfs_info);
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -175,9 +180,9 @@ int mc_mkdir (char *path, mode_t mode);
|
||||
|
||||
char *mc_getlocalcopy (const char *pathname);
|
||||
int mc_ungetlocalcopy (const char *pathname, char *local, int has_changed);
|
||||
char *mc_def_getlocalcopy (struct vfs_class *vfs, char *filename);
|
||||
int mc_def_ungetlocalcopy (struct vfs_class *vfs, char *filename, char *local,
|
||||
int has_changed);
|
||||
char *mc_def_getlocalcopy (struct vfs_class *vfs, const char *filename);
|
||||
int mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
||||
char *local, int has_changed);
|
||||
int mc_ctl (int fd, int ctlop, void *arg);
|
||||
int mc_setctl (char *path, int ctlop, void *arg);
|
||||
#ifdef HAVE_MMAP
|
||||
|
@ -121,11 +121,11 @@ struct vfs_s_subclass {
|
||||
void (*free_inode) (struct vfs_class *me, struct vfs_s_inode *ino); /* optional */
|
||||
int (*init_entry) (struct vfs_class *me, struct vfs_s_entry *entry); /* optional */
|
||||
|
||||
void *(*archive_check) (struct vfs_class *me, char *name, char *op); /* optional */
|
||||
void *(*archive_check) (struct vfs_class *me, const char *name, char *op); /* optional */
|
||||
int (*archive_same) (struct vfs_class *me, struct vfs_s_super *psup,
|
||||
char *archive_name, char *op, void *cookie);
|
||||
const char *archive_name, char *op, void *cookie);
|
||||
int (*open_archive) (struct vfs_class *me, struct vfs_s_super *psup,
|
||||
char *archive_name, char *op);
|
||||
const char *archive_name, char *op);
|
||||
void (*free_archive) (struct vfs_class *me,
|
||||
struct vfs_s_super *psup);
|
||||
|
||||
@ -180,7 +180,7 @@ struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me,
|
||||
|
||||
/* outside interface */
|
||||
void vfs_s_init_class (struct vfs_class *vclass);
|
||||
char *vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
|
||||
char *vfs_s_get_path_mangle (struct vfs_class *me, const char *inname,
|
||||
struct vfs_s_super **archive, int flags);
|
||||
void vfs_s_invalidate (struct vfs_class *me, struct vfs_s_super *super);
|
||||
char *vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user