* smbfs.c (statfile_helper): Merge with loaddir_helper().
(get_remote_stat): Use loaddir_helper(). Care about single_entry instead of eliminated statfile_helper().
Этот коммит содержится в:
родитель
39fb489652
Коммит
14c3f90d2f
@ -1,5 +1,9 @@
|
|||||||
2002-09-11 Andrew V. Samoilov <sav@bcs.zp.ua>
|
2002-09-11 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
|
* smbfs.c (statfile_helper): Merge with loaddir_helper().
|
||||||
|
(get_remote_stat): Use loaddir_helper(). Care about
|
||||||
|
single_entry instead of eliminated statfile_helper().
|
||||||
|
|
||||||
* samba/libsmb/clientgen.c (cli_NetServerEnum): Add void*
|
* samba/libsmb/clientgen.c (cli_NetServerEnum): Add void*
|
||||||
parameter to (*fn)() and void *state parameter.
|
parameter to (*fn)() and void *state parameter.
|
||||||
(cli_list): Likewise.
|
(cli_list): Likewise.
|
||||||
|
67
vfs/smbfs.c
67
vfs/smbfs.c
@ -454,12 +454,13 @@ browsing_helper (const char *name, uint32 type, const char *comment, void *state
|
|||||||
static void
|
static void
|
||||||
loaddir_helper (file_info * finfo, const char *mask, void *entry)
|
loaddir_helper (file_info * finfo, const char *mask, void *entry)
|
||||||
{
|
{
|
||||||
dir_entry *new_entry;
|
dir_entry *new_entry = (dir_entry *) entry;
|
||||||
time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
|
time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
|
||||||
#if 0 /* I want to see dot files */
|
#if 0 /* I want to see dot files */
|
||||||
if (finfo->mode & aHIDDEN)
|
if (finfo->mode & aHIDDEN)
|
||||||
return; /* don't bother with hidden files, "~$" screws up mc */
|
return; /* don't bother with hidden files, "~$" screws up mc */
|
||||||
#endif
|
#endif
|
||||||
|
if (!entry)
|
||||||
new_entry = new_dir_entry (finfo->name);
|
new_entry = new_dir_entry (finfo->name);
|
||||||
|
|
||||||
new_entry->my_stat.st_size = finfo->size;
|
new_entry->my_stat.st_size = finfo->size;
|
||||||
@ -469,12 +470,12 @@ loaddir_helper (file_info * finfo, const char *mask, void *entry)
|
|||||||
new_entry->my_stat.st_uid = finfo->uid;
|
new_entry->my_stat.st_uid = finfo->uid;
|
||||||
new_entry->my_stat.st_gid = finfo->gid;
|
new_entry->my_stat.st_gid = finfo->gid;
|
||||||
|
|
||||||
new_entry->my_stat.st_mode =
|
new_entry->my_stat.st_mode = /* rw-rw-rw */
|
||||||
S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH;
|
S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH;
|
||||||
|
|
||||||
/* if (finfo->mode & aVOLID); nothing similar in real world */
|
/* if (finfo->mode & aVOLID); nothing similar in real world */
|
||||||
if (finfo->mode & aDIR)
|
if (finfo->mode & aDIR)
|
||||||
new_entry->my_stat.st_mode |=
|
new_entry->my_stat.st_mode |= /* drwxrwxrwx */
|
||||||
S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
|
S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
|
||||||
else
|
else
|
||||||
new_entry->my_stat.st_mode |= S_IFREG; /* if not dir, regular file? */
|
new_entry->my_stat.st_mode |= S_IFREG; /* if not dir, regular file? */
|
||||||
@ -484,10 +485,11 @@ loaddir_helper (file_info * finfo, const char *mask, void *entry)
|
|||||||
if (finfo->mode & aRONLY)
|
if (finfo->mode & aRONLY)
|
||||||
new_entry->my_stat.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
|
new_entry->my_stat.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
|
||||||
|
|
||||||
DEBUG (3, (" %-30s%7.7s%8.0f %s",
|
DEBUG (entry ? 3 : 6, (" %-30s%7.7s%8.0f %s",
|
||||||
CNV_LANG (finfo->name),
|
CNV_LANG (finfo->name),
|
||||||
attrib_string (finfo->mode),
|
attrib_string (finfo->mode),
|
||||||
(double) finfo->size, asctime (LocalTime (&t))));
|
(double) finfo->size,
|
||||||
|
asctime (LocalTime (&t))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* takes "/foo/bar/file" and gives malloced "\\foo\\bar\\file" */
|
/* takes "/foo/bar/file" and gives malloced "\\foo\\bar\\file" */
|
||||||
@ -1263,48 +1265,6 @@ fake_share_stat(const char *server_url, const char *path, struct stat *buf)
|
|||||||
/* stat a single file, get_remote_stat callback */
|
/* stat a single file, get_remote_stat callback */
|
||||||
static dir_entry *single_entry;
|
static dir_entry *single_entry;
|
||||||
|
|
||||||
static void
|
|
||||||
statfile_helper (file_info * finfo, const char *mask, void * entry)
|
|
||||||
{
|
|
||||||
time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
|
|
||||||
|
|
||||||
#if 0 /* single_entry is never free()d now. And only my_stat is used */
|
|
||||||
single_entry = g_new (dir_entry, 1);
|
|
||||||
|
|
||||||
single_entry->text = dos_to_unix (g_strdup (finfo->name), 1);
|
|
||||||
|
|
||||||
single_entry->next = 0;
|
|
||||||
#endif
|
|
||||||
if (!single_entry)
|
|
||||||
single_entry = g_new0 (dir_entry, 1);
|
|
||||||
|
|
||||||
single_entry->my_stat.st_size = finfo->size;
|
|
||||||
single_entry->my_stat.st_mtime = finfo->mtime;
|
|
||||||
single_entry->my_stat.st_atime = finfo->atime;
|
|
||||||
single_entry->my_stat.st_ctime = finfo->ctime;
|
|
||||||
single_entry->my_stat.st_uid = finfo->uid;
|
|
||||||
single_entry->my_stat.st_gid = finfo->gid;
|
|
||||||
|
|
||||||
single_entry->my_stat.st_mode = /* rw-rw-rw */
|
|
||||||
S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH;
|
|
||||||
|
|
||||||
/* if (finfo->mode & aVOLID); nothing similar in real world */
|
|
||||||
if (finfo->mode & aDIR) /* drwxrwxrwx */
|
|
||||||
single_entry->my_stat.st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
|
|
||||||
else /* if not dir, regular file? */
|
|
||||||
single_entry->my_stat.st_mode |= S_IFREG;
|
|
||||||
/* if (finfo->mode & aARCH); DOS archive */
|
|
||||||
/* if (finfo->mode & aHIDDEN); like a dot file? */
|
|
||||||
/* if (finfo->mode & aSYSTEM); like a kernel? */
|
|
||||||
if (finfo->mode & aRONLY)
|
|
||||||
single_entry->my_stat.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
|
|
||||||
|
|
||||||
DEBUG (6, (" %-30s%7.7s%8.0f %s",
|
|
||||||
CNV_LANG (finfo->name),
|
|
||||||
attrib_string (finfo->mode),
|
|
||||||
(double) finfo->size, asctime (LocalTime (&t))));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* stat a single file */
|
/* stat a single file */
|
||||||
static int
|
static int
|
||||||
get_remote_stat (smbfs_connection * sc, char *path, struct stat *buf)
|
get_remote_stat (smbfs_connection * sc, char *path, struct stat *buf)
|
||||||
@ -1316,7 +1276,18 @@ get_remote_stat(smbfs_connection *sc, char *path, struct stat *buf)
|
|||||||
|
|
||||||
convert_path (&mypath, FALSE);
|
convert_path (&mypath, FALSE);
|
||||||
|
|
||||||
if (cli_list(sc->cli, mypath, attribute, statfile_helper, &single_entry) < 1) {
|
#if 0 /* single_entry is never free()d now. And only my_stat is used */
|
||||||
|
single_entry = g_new (dir_entry, 1);
|
||||||
|
|
||||||
|
single_entry->text = dos_to_unix (g_strdup (finfo->name), 1);
|
||||||
|
|
||||||
|
single_entry->next = 0;
|
||||||
|
#endif
|
||||||
|
if (!single_entry)
|
||||||
|
single_entry = g_new0 (dir_entry, 1);
|
||||||
|
|
||||||
|
if (cli_list
|
||||||
|
(sc->cli, mypath, attribute, loaddir_helper, single_entry) < 1) {
|
||||||
my_errno = ENOENT;
|
my_errno = ENOENT;
|
||||||
g_free (mypath);
|
g_free (mypath);
|
||||||
return -1; /* cli_list returns number of files */
|
return -1; /* cli_list returns number of files */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user