mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-11-28 09:49:27 +00:00
Add raw device write param
This commit is contained in:
parent
7bd16d07b3
commit
0910f55817
@ -1,2 +1,2 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
/usr/local/bin/fusea2pi $1 $2 -o uid=`id -u` -o gid=`id -g`
|
/usr/local/bin/fusea2pi $1 -o uid=`id -u` -o gid=`id -g` $2
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#define FALSE 0
|
||||||
|
#define TRUE (!FALSE)
|
||||||
/*
|
/*
|
||||||
* ProDOS Commands.
|
* ProDOS Commands.
|
||||||
*/
|
*/
|
||||||
@ -113,6 +114,10 @@ static unsigned int volblks[16];
|
|||||||
pthread_mutex_t a2pi_busy = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t a2pi_busy = PTHREAD_MUTEX_INITIALIZER;
|
||||||
#define A2PI_WAIT pthread_mutex_lock(&a2pi_busy)
|
#define A2PI_WAIT pthread_mutex_lock(&a2pi_busy)
|
||||||
#define A2PI_RELEASE pthread_mutex_unlock(&a2pi_busy)
|
#define A2PI_RELEASE pthread_mutex_unlock(&a2pi_busy)
|
||||||
|
/*
|
||||||
|
* Raw device write flag.
|
||||||
|
*/
|
||||||
|
int raw_dev_write = FALSE;
|
||||||
/*
|
/*
|
||||||
* Filename & date/time conversion routines.
|
* Filename & date/time conversion routines.
|
||||||
*/
|
*/
|
||||||
@ -211,12 +216,12 @@ struct stat *unix_stat(struct stat *stbuf, int storage, int access, int blocks,
|
|||||||
memset(stbuf, 0, sizeof(struct stat));
|
memset(stbuf, 0, sizeof(struct stat));
|
||||||
if (storage == 0x0F || storage == 0x0D)
|
if (storage == 0x0F || storage == 0x0D)
|
||||||
{
|
{
|
||||||
stbuf->st_mode = (access & 0xC3 == 0xC3) ? S_IFDIR | 0744 : S_IFDIR | 0544;
|
stbuf->st_mode = (access & 0xC3) == 0xC3 ? S_IFDIR | 0744 : S_IFDIR | 0544;
|
||||||
stbuf->st_nlink = 2;
|
stbuf->st_nlink = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stbuf->st_mode = (access & 0xC3 == 0xC3) ? S_IFREG | 0644 : S_IFREG | 0444;
|
stbuf->st_mode = (access & 0xC3) == 0xC3 ? S_IFREG | 0644 : S_IFREG | 0444;
|
||||||
stbuf->st_nlink = 1;
|
stbuf->st_nlink = 1;
|
||||||
stbuf->st_blocks = blocks;
|
stbuf->st_blocks = blocks;
|
||||||
stbuf->st_size = size;
|
stbuf->st_size = size;
|
||||||
@ -766,7 +771,7 @@ static int cache_get_file_info(const char *path, int *access, int *type, int *au
|
|||||||
drive = (path[4] - '1') & 0x01;
|
drive = (path[4] - '1') & 0x01;
|
||||||
*storage = 0x100;
|
*storage = 0x100;
|
||||||
*type = 0x00;
|
*type = 0x00;
|
||||||
*access = 0xC3;
|
*access = raw_dev_write ? 0xC3 : 0x01;
|
||||||
*aux = 0;
|
*aux = 0;
|
||||||
*numblks = volblks[slot | (drive << 3)];
|
*numblks = volblks[slot | (drive << 3)];
|
||||||
*size = *numblks*512;
|
*size = *numblks*512;
|
||||||
@ -981,7 +986,7 @@ static int a2pi_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
|
|||||||
strcpy(filename, "s0d0.po");
|
strcpy(filename, "s0d0.po");
|
||||||
filename[1] = slot + '0';
|
filename[1] = slot + '0';
|
||||||
filename[3] = drive + '1';
|
filename[3] = drive + '1';
|
||||||
straw.st_mode = S_IFREG | 0644;
|
straw.st_mode = raw_dev_write ? S_IFREG | 0644 : S_IFREG | 0444;
|
||||||
straw.st_nlink = 1;
|
straw.st_nlink = 1;
|
||||||
straw.st_blocks = volblks[i];
|
straw.st_blocks = volblks[i];
|
||||||
straw.st_size = straw.st_blocks * 512;
|
straw.st_size = straw.st_blocks * 512;
|
||||||
@ -1191,7 +1196,8 @@ static int a2pi_write(const char *path, const char *buf, size_t size, off_t offs
|
|||||||
cachepath[0] = '\0';
|
cachepath[0] = '\0';
|
||||||
if (IS_ROOT_DIR(path))
|
if (IS_ROOT_DIR(path))
|
||||||
{
|
{
|
||||||
#if 0
|
if (raw_dev_write)
|
||||||
|
{
|
||||||
if (IS_RAW_DEV(strlen(path), path))
|
if (IS_RAW_DEV(strlen(path), path))
|
||||||
{
|
{
|
||||||
slot = (path[2] - '0') & 0x07;
|
slot = (path[2] - '0') & 0x07;
|
||||||
@ -1218,9 +1224,9 @@ static int a2pi_write(const char *path, const char *buf, size_t size, off_t offs
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
#else
|
}
|
||||||
|
else
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if ((refnum = prodos_open(prodos_path(path, NULL, NULL, NULL), &io_buff)) > 0)
|
if ((refnum = prodos_open(prodos_path(path, NULL, NULL, NULL), &io_buff)) > 0)
|
||||||
{
|
{
|
||||||
@ -1353,6 +1359,11 @@ int main(int argc, char *argv[])
|
|||||||
volblks[0x06] = 280;
|
volblks[0x06] = 280;
|
||||||
if (volblks[0x0E] == 0)
|
if (volblks[0x0E] == 0)
|
||||||
volblks[0x0E] = 280;
|
volblks[0x0E] = 280;
|
||||||
|
if (strcmp(argv[argc - 1], "+rw") == 0)
|
||||||
|
{
|
||||||
|
raw_dev_write = TRUE;
|
||||||
|
argc--;
|
||||||
|
}
|
||||||
umask(0);
|
umask(0);
|
||||||
return fuse_main(argc, argv, &a2pi_oper, NULL);
|
return fuse_main(argc, argv, &a2pi_oper, NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user