Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/mips/beri/loader/beri_disk_sdcard.c
Show All 38 Lines | |||||
#include <stand.h> | #include <stand.h> | ||||
#include <disk.h> | #include <disk.h> | ||||
#include <sdcard.h> | #include <sdcard.h> | ||||
static int beri_sdcard_disk_init(void); | static int beri_sdcard_disk_init(void); | ||||
static int beri_sdcard_disk_open(struct open_file *, ...); | static int beri_sdcard_disk_open(struct open_file *, ...); | ||||
static int beri_sdcard_disk_close(struct open_file *); | static int beri_sdcard_disk_close(struct open_file *); | ||||
static void beri_sdcard_disk_cleanup(void); | |||||
static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, | static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, | ||||
char *, size_t *); | char *, size_t *); | ||||
static int beri_sdcard_disk_print(int); | static int beri_sdcard_disk_print(int); | ||||
struct devsw beri_sdcard_disk = { | struct devsw beri_sdcard_disk = { | ||||
.dv_name = "sdcard", | .dv_name = "sdcard", | ||||
.dv_type = DEVT_DISK, | .dv_type = DEVT_DISK, | ||||
.dv_init = beri_sdcard_disk_init, | .dv_init = beri_sdcard_disk_init, | ||||
.dv_strategy = beri_sdcard_disk_strategy, | .dv_strategy = beri_sdcard_disk_strategy, | ||||
.dv_open = beri_sdcard_disk_open, | .dv_open = beri_sdcard_disk_open, | ||||
.dv_close = beri_sdcard_disk_close, | .dv_close = beri_sdcard_disk_close, | ||||
.dv_ioctl = noioctl, | .dv_ioctl = noioctl, | ||||
.dv_print = beri_sdcard_disk_print, | .dv_print = beri_sdcard_disk_print, | ||||
.dv_cleanup = beri_sdcard_disk_cleanup, | .dv_cleanup = NULL, | ||||
smh: Is this alignment issue a reviews problem or actually in the code? | |||||
Not Done Inline ActionsAfter careful check - it was space issue, thanks. tsoome: After careful check - it was space issue, thanks. | |||||
}; | }; | ||||
static int | static int | ||||
beri_sdcard_disk_init(void) | beri_sdcard_disk_init(void) | ||||
{ | { | ||||
return (0); | return (0); | ||||
} | } | ||||
Show All 31 Lines | beri_sdcard_disk_open(struct open_file *f, ...) | ||||
if (!(altera_sdcard_get_present())) { | if (!(altera_sdcard_get_present())) { | ||||
printf("SD card not present or not supported\n"); | printf("SD card not present or not supported\n"); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
if (dev->d_unit != 0) | if (dev->d_unit != 0) | ||||
return (EIO); | return (EIO); | ||||
return (disk_open(dev, altera_sdcard_get_mediasize(), | return (disk_open(dev, altera_sdcard_get_mediasize(), | ||||
altera_sdcard_get_sectorsize(), 0)); | altera_sdcard_get_sectorsize())); | ||||
} | } | ||||
static int | static int | ||||
beri_sdcard_disk_close(struct open_file *f) | beri_sdcard_disk_close(struct open_file *f) | ||||
{ | { | ||||
struct disk_devdesc *dev; | struct disk_devdesc *dev; | ||||
dev = (struct disk_devdesc *)f->f_devdata; | dev = (struct disk_devdesc *)f->f_devdata; | ||||
Show All 15 Lines | beri_sdcard_disk_print(int verbose) | ||||
ret = pager_output(line); | ret = pager_output(line); | ||||
if (ret != 0) | if (ret != 0) | ||||
return (ret); | return (ret); | ||||
dev.d_dev = &beri_sdcard_disk; | dev.d_dev = &beri_sdcard_disk; | ||||
dev.d_unit = 0; | dev.d_unit = 0; | ||||
dev.d_slice = -1; | dev.d_slice = -1; | ||||
dev.d_partition = -1; | dev.d_partition = -1; | ||||
if (disk_open(&dev, altera_sdcard_get_mediasize(), | if (disk_open(&dev, altera_sdcard_get_mediasize(), | ||||
altera_sdcard_get_sectorsize(), 0) == 0) { | altera_sdcard_get_sectorsize()) == 0) { | ||||
snprintf(line, sizeof(line), " sdcard%d", 0); | snprintf(line, sizeof(line), " sdcard%d", 0); | ||||
ret = disk_print(&dev, line, verbose); | ret = disk_print(&dev, line, verbose); | ||||
disk_close(&dev); | disk_close(&dev); | ||||
} | } | ||||
return (ret); | return (ret); | ||||
} | |||||
static void | |||||
beri_sdcard_disk_cleanup(void) | |||||
{ | |||||
disk_cleanup(&beri_sdcard_disk); | |||||
} | } |
Is this alignment issue a reviews problem or actually in the code?