1 /* shared_info.h: shared info for cygwin
3 Copyright 2000, 2001 Red Hat, Inc.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
13 /* Mount table entry */
18 /* FIXME: Nasty static allocation. Need to have a heap in the shared
19 area [with the user being able to configure at runtime the max size]. */
20 /* Win32-style mounted partition source ("C:\foo\bar").
21 native_path[0] == 0 for unused entries. */
22 char native_path
[MAX_PATH
];
25 /* POSIX-style mount point ("/foo/bar") */
26 char posix_path
[MAX_PATH
];
31 void init (const char *dev
, const char *path
, unsigned flags
);
33 struct mntent
*getmntent ();
34 void fnmunge (char *, const char *);
35 void build_win32 (char *, const char *, unsigned *, unsigned);
38 /* Warning: Decreasing this value will cause cygwin.dll to ignore existing
39 higher numbered registry entries. Don't change this number willy-nilly.
40 What we need is to have a more dynamic allocation scheme, but the current
41 scheme should be satisfactory for a long while yet. */
44 #define MOUNT_VERSION 27 // increment when mount table changes and
45 #define MOUNT_VERSION_MAGIC CYGWIN_VERSION_MAGIC (MOUNT_MAGIC, MOUNT_VERSION)
46 #define CURR_MOUNT_MAGIC 0x4fe431cdU
47 #define MOUNT_INFO_CB 16488
51 /* NOTE: Do not make gratuitous changes to the names or organization of the
52 below class. The layout is checksummed to determine compatibility between
53 different cygwin versions. */
59 DWORD sys_mount_table_counter
;
61 mount_item mount
[MAX_MOUNTS
];
63 /* cygdrive_prefix is used as the root of the path automatically
64 prepended to a path when the path has no associated mount.
65 cygdrive_flags are the default flags for the cygdrives. */
66 char cygdrive
[MAX_PATH
];
68 unsigned cygdrive_flags
;
70 int posix_sorted
[MAX_MOUNTS
];
71 int native_sorted
[MAX_MOUNTS
];
74 /* Increment when setting up a reg_key if mounts area had to be
75 created so we know when we need to import old mount tables. */
76 int had_to_create_mount_areas
;
79 int add_item (const char *dev
, const char *path
, unsigned flags
, int reg_p
);
80 int del_item (const char *path
, unsigned flags
, int reg_p
);
82 void from_registry ();
83 int add_reg_mount (const char * native_path
, const char * posix_path
,
85 int del_reg_mount (const char * posix_path
, unsigned mountflags
);
87 unsigned set_flags_from_win32_path (const char *path
);
88 int conv_to_win32_path (const char *src_path
, char *dst
, DWORD
&devn
,
89 int &unit
, unsigned *flags
= NULL
, bool no_normalize
= 0);
90 int conv_to_posix_path (const char *src_path
, char *posix_path
,
92 struct mntent
*getmntent (int x
);
94 int write_cygdrive_info_to_registry (const char *cygdrive_prefix
, unsigned flags
);
95 int remove_cygdrive_info_from_registry (const char *cygdrive_prefix
, unsigned flags
);
96 int get_cygdrive_info (char *user
, char *system
, char* user_flags
,
102 void read_mounts (reg_key
& r
);
106 int cygdrive_win32_path (const char *src
, char *dst
, int& unit
);
107 void cygdrive_posix_path (const char *src
, char *dst
, int trailing_slash_p
);
108 void read_cygdrive_info_from_registry ();
111 /******** Close-on-delete queue ********/
113 /* First pass at a file deletion queue structure.
115 We can't keep this list in the per-process info, since
116 one process may open a file, and outlive a process which
117 wanted to unlink the file - and the data would go away.
120 #define MAX_DELQUEUES_PENDING 100
124 char name
[MAX_DELQUEUES_PENDING
][MAX_PATH
];
125 char inuse
[MAX_DELQUEUES_PENDING
];
130 void queue_file (const char *dosname
);
131 void process_queue ();
134 /******** Shared Info ********/
135 /* Data accessible to all tasks */
137 #define SHARED_VERSION (unsigned)(cygwin_version.api_major << 8 | \
138 cygwin_version.api_minor)
139 #define SHARED_VERSION_MAGIC CYGWIN_VERSION_MAGIC (SHARED_MAGIC, SHARED_VERSION)
141 #define SHARED_INFO_CB 47112
143 #define CURR_SHARED_MAGIC 0x53f1a7f4U
145 /* NOTE: Do not make gratuitous changes to the names or organization of the
146 below class. The layout is checksummed to determine compatibility between
147 different cygwin versions. */
154 DWORD sys_mount_table_counter
;
157 delqueue_list delqueue
;
158 void initialize (const char *);
159 unsigned heap_chunk_size ();
162 extern shared_info
*cygwin_shared
;
163 extern mount_info
*mount_table
;
164 extern HANDLE cygwin_mount_h
;
166 enum shared_locations
174 void __stdcall
memory_init ();
176 #define shared_align_past(p) \
177 ((char *) (system_info.dwAllocationGranularity * \
178 (((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
179 system_info.dwAllocationGranularity)))
181 #define cygwin_shared_address ((void *) 0xa000000)
186 tty_min tty_min_state
;
187 dev_console dev_state
;
191 char *__stdcall
shared_name (char *, const char *, int);
192 void *__stdcall
open_shared (const char *name
, int n
, HANDLE
&shared_h
, DWORD size
, shared_locations
);