* Makefile.in: Add dependencies for fhandler_random.o

* fhandler.h: Add device type FH_RANDOM. Add class
        fhandler_dev_random.
        * fhandler_random.cc: New file. Implementation of
        fhandler_dev_random.
        * hinfo.cc (build_fhandler): Add case for FH_RANDOM.
        * path.cc: Add device names for random devices to
        windows_device_names.
        (get_device_number): Add if branch for random devices.
        (win32_device_name): Add device name generation for
        random devices.
        winsup.h: Include <wincrypt.h>.
This commit is contained in:
Corinna Vinschen
2000-05-03 15:39:10 +00:00
parent 49d64538cd
commit 1c0c369b36
7 changed files with 144 additions and 3 deletions

View File

@@ -91,8 +91,9 @@ enum
FH_TAPE = 0x00000012, /* is a tape */
FH_NULL = 0x00000013, /* is the null device */
FH_ZERO = 0x00000014, /* is the zero device */
FH_RANDOM = 0x00000015, /* is a random device */
FH_NDEV = 0x00000015, /* Maximum number of devices */
FH_NDEV = 0x00000016, /* Maximum number of devices */
FH_DEVMASK = 0x00000fff, /* devices live here */
FH_BAD = 0xffffffff
};
@@ -732,6 +733,24 @@ public:
void dump ();
};
class fhandler_dev_random: public fhandler_base
{
protected:
int unit;
HCRYPTPROV crypt_prov;
public:
fhandler_dev_random (const char *name, int unit);
int get_unit () { return unit; }
int open (const char *path, int flags, mode_t mode = 0);
int write (const void *ptr, size_t len);
int read (void *ptr, size_t len);
off_t lseek (off_t offset, int whence);
int close (void);
int dup (fhandler_base *child);
void dump ();
};
class fhandler_windows: public fhandler_base
{
private: