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]. */
21 /* Win32-style mounted partition source ("C:\foo\bar").
22 native_path[0] == 0 for unused entries. */
23 char native_path
[MAX_PATH
];
26 /* POSIX-style mount point ("/foo/bar") */
27 char posix_path
[MAX_PATH
];
32 void init (const char *dev
, const char *path
, unsigned flags
);
34 struct mntent
*getmntent ();
37 /* Warning: Decreasing this value will cause cygwin.dll to ignore existing
38 higher numbered registry entries. Don't change this number willy-nilly.
39 What we need is to have a more dynamic allocation scheme, but the current
40 scheme should be satisfactory for a long while yet. */
43 #define MOUNT_VERSION 0x01010103
50 DWORD sys_mount_table_counter
;
52 mount_item mount
[MAX_MOUNTS
];
54 /* cygdrive_prefix is used as the root of the path automatically
55 prepended to a path when the path has no associated mount.
56 cygdrive_flags are the default flags for the cygdrives. */
57 char cygdrive
[MAX_PATH
];
59 unsigned cygdrive_flags
;
61 int posix_sorted
[MAX_MOUNTS
];
62 int native_sorted
[MAX_MOUNTS
];
65 /* Increment when setting up a reg_key if mounts area had to be
66 created so we know when we need to import old mount tables. */
67 int had_to_create_mount_areas
;
70 int add_item (const char *dev
, const char *path
, unsigned flags
, int reg_p
);
71 int del_item (const char *path
, unsigned flags
, int reg_p
);
73 void from_registry ();
74 int add_reg_mount (const char * native_path
, const char * posix_path
,
76 int del_reg_mount (const char * posix_path
, unsigned mountflags
);
78 unsigned set_flags_from_win32_path (const char *path
);
79 int conv_to_win32_path (const char *src_path
, char *dst
, DWORD
&devn
,
80 int &unit
, unsigned *flags
= NULL
, bool no_normalize
= 0);
81 int conv_to_posix_path (const char *src_path
, char *posix_path
,
83 struct mntent
*getmntent (int x
);
85 int write_cygdrive_info_to_registry (const char *cygdrive_prefix
, unsigned flags
);
86 int remove_cygdrive_info_from_registry (const char *cygdrive_prefix
, unsigned flags
);
87 int get_cygdrive_info (char *user
, char *system
, char* user_flags
,
90 void import_v1_mounts ();
95 void read_mounts (reg_key
& r
);
96 void read_v1_mounts (reg_key r
, unsigned which
);
100 int cygdrive_win32_path (const char *src
, char *dst
, int trailing_slash_p
);
101 void cygdrive_posix_path (const char *src
, char *dst
, int trailing_slash_p
);
102 void read_cygdrive_info_from_registry ();
105 /******** Close-on-delete queue ********/
107 /* First pass at a file deletion queue structure.
109 We can't keep this list in the per-process info, since
110 one process may open a file, and outlive a process which
111 wanted to unlink the file - and the data would go away.
114 #define MAX_DELQUEUES_PENDING 100
118 char name
[MAX_DELQUEUES_PENDING
][MAX_PATH
];
119 char inuse
[MAX_DELQUEUES_PENDING
];
124 void queue_file (const char *dosname
);
125 void process_queue ();
128 /******** Shared Info ********/
129 /* Data accessible to all tasks */
135 int heap_chunk_in_mb
;
136 DWORD sys_mount_table_counter
;
139 delqueue_list delqueue
;
141 unsigned heap_chunk_size ();
144 extern shared_info
*cygwin_shared
;
145 extern mount_info
*mount_table
;
146 extern HANDLE cygwin_mount_h
;
148 void __stdcall
memory_init (void);
149 void __stdcall
shared_terminate (void);
151 #define shared_align_past(p) \
152 ((char *) (system_info.dwAllocationGranularity * \
153 (((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
154 system_info.dwAllocationGranularity)))
156 #define cygwin_shared_address ((void *) 0xa000000)
157 #define mount_table_address shared_align_past (cygwin_shared)
158 #define cygheap_address shared_align_past ((mount_info *) shared_align_past (cygwin_shared))
160 char *__stdcall
shared_name (const char *, int);
161 void *__stdcall
open_shared (const char *name
, HANDLE
&shared_h
, DWORD size
, void *addr
);