* mount.cc: Change comment.
(smb_extended_info): Move here from path.cc. (fs_info::update): Ditto. (mount_info::create_root_entry): Delay conversion to slashes and use passed in buffer to figure out fs type. * path.cc (smb_extended_info): Move. (fs_info::update): Ditto. * mount.h: New file. Move mount information here. * path.h: (fs_info::update): Move. * shared_info.h (mount_item): Ditto.
This commit is contained in:
@ -12,96 +12,7 @@ details. */
|
||||
#include "security.h"
|
||||
#include "mtinfo.h"
|
||||
#include "limits.h"
|
||||
|
||||
/* Mount table entry */
|
||||
|
||||
class mount_item
|
||||
{
|
||||
public:
|
||||
/* FIXME: Nasty static allocation. Need to have a heap in the shared
|
||||
area [with the user being able to configure at runtime the max size]. */
|
||||
/* Win32-style mounted partition source ("C:\foo\bar").
|
||||
native_path[0] == 0 for unused entries. */
|
||||
char native_path[CYG_MAX_PATH];
|
||||
int native_pathlen;
|
||||
|
||||
/* POSIX-style mount point ("/foo/bar") */
|
||||
char posix_path[CYG_MAX_PATH];
|
||||
int posix_pathlen;
|
||||
|
||||
unsigned flags;
|
||||
|
||||
void init (const char *dev, const char *path, unsigned flags);
|
||||
|
||||
struct mntent *getmntent ();
|
||||
int build_win32 (char *, const char *, unsigned *, unsigned);
|
||||
};
|
||||
|
||||
/* Warning: Decreasing this value will cause cygwin.dll to ignore existing
|
||||
higher numbered registry entries. Don't change this number willy-nilly.
|
||||
What we need is to have a more dynamic allocation scheme, but the current
|
||||
scheme should be satisfactory for a long while yet. */
|
||||
#define MAX_MOUNTS 30
|
||||
|
||||
#define USER_VERSION 1 // increment when mount table changes and
|
||||
#define USER_VERSION_MAGIC CYGWIN_VERSION_MAGIC (USER_MAGIC, USER_VERSION)
|
||||
#define CURR_USER_MAGIC 0xb2232e71U
|
||||
|
||||
class reg_key;
|
||||
struct device;
|
||||
|
||||
/* NOTE: Do not make gratuitous changes to the names or organization of the
|
||||
below class. The layout is checksummed to determine compatibility between
|
||||
different cygwin versions. */
|
||||
class mount_info
|
||||
{
|
||||
public:
|
||||
DWORD sys_mount_table_counter;
|
||||
int nmounts;
|
||||
mount_item mount[MAX_MOUNTS];
|
||||
|
||||
/* cygdrive_prefix is used as the root of the path automatically
|
||||
prepended to a path when the path has no associated mount.
|
||||
cygdrive_flags are the default flags for the cygdrives. */
|
||||
char cygdrive[CYG_MAX_PATH];
|
||||
size_t cygdrive_len;
|
||||
unsigned cygdrive_flags;
|
||||
private:
|
||||
int posix_sorted[MAX_MOUNTS];
|
||||
int native_sorted[MAX_MOUNTS];
|
||||
|
||||
public:
|
||||
void init ();
|
||||
int add_item (const char *dev, const char *path, unsigned flags);
|
||||
int del_item (const char *path, unsigned flags);
|
||||
|
||||
unsigned set_flags_from_win32_path (const char *path);
|
||||
int conv_to_win32_path (const char *src_path, char *dst, device&,
|
||||
unsigned *flags = NULL);
|
||||
int conv_to_posix_path (PWCHAR src_path, char *posix_path,
|
||||
int keep_rel_p);
|
||||
int conv_to_posix_path (const char *src_path, char *posix_path,
|
||||
int keep_rel_p);
|
||||
struct mntent *getmntent (int x);
|
||||
|
||||
int write_cygdrive_info (const char *cygdrive_prefix, unsigned flags);
|
||||
int get_cygdrive_info (char *user, char *system, char* user_flags,
|
||||
char* system_flags);
|
||||
void cygdrive_posix_path (const char *src, char *dst, int trailing_slash_p);
|
||||
int get_mounts_here (const char *parent_dir, int,
|
||||
PUNICODE_STRING mount_points,
|
||||
PUNICODE_STRING cygd);
|
||||
|
||||
private:
|
||||
void sort ();
|
||||
void mount_slash ();
|
||||
void create_root_entry (const PWCHAR root);
|
||||
|
||||
bool from_fstab_line (char *line, bool user);
|
||||
bool from_fstab (bool user, WCHAR [], PWCHAR);
|
||||
|
||||
int cygdrive_win32_path (const char *src, char *dst, int& unit);
|
||||
};
|
||||
#include "mount.h"
|
||||
|
||||
class user_info
|
||||
{
|
||||
|
Reference in New Issue
Block a user