device reference count

42 views
Skip to first unread message

ajron

unread,
May 6, 2013, 6:44:09 AM5/6/13
to uf...@googlegroups.com

I think that following functions in uffs_fd.c (master branch) should use uffs_PutDevice(dev) to decrease the reference count after uffs_GetDeviceXXX(dev).


long uffs_space_total(const char *mount_point)
{
uffs_Device *dev = NULL;
long ret = -1L;

dev = uffs_GetDeviceFromMountPoint(mount_point);
if (dev) {
uffs_GlobalFsLockLock();
ret = (long) uffs_GetDeviceTotal(dev);
uffs_PutDevice(dev);
uffs_GlobalFsLockUnlock();
}

return ret;
}

long uffs_space_used(const char *mount_point)
{
uffs_Device *dev = NULL;
long ret = -1L;

dev = uffs_GetDeviceFromMountPoint(mount_point);
if (dev) {
uffs_GlobalFsLockLock();
ret = (long) uffs_GetDeviceUsed(dev);
uffs_PutDevice(dev);
uffs_GlobalFsLockUnlock();
}

return ret;
}

long uffs_space_free(const char *mount_point)
{
uffs_Device *dev = NULL;
long ret = -1L;

dev = uffs_GetDeviceFromMountPoint(mount_point);
if (dev) {
uffs_GlobalFsLockLock();
ret = (long) uffs_GetDeviceFree(dev);
uffs_PutDevice(dev);
uffs_GlobalFsLockUnlock();
}

return ret;
}

int uffs_format(const char *mount_point)
{
uffs_Device *dev = NULL;
URET ret = U_FAIL;

dev = uffs_GetDeviceFromMountPoint(mount_point);
if (dev) {
uffs_GlobalFsLockLock();
ret = uffs_FormatDevice(dev, U_TRUE);
uffs_PutDevice(dev);
uffs_GlobalFsLockUnlock();
}

return ret == U_SUCC ? 0 : -1;
}

Ricky Zheng

unread,
May 7, 2013, 8:30:58 AM5/7/13
to uf...@googlegroups.com
Thanks, I'll fix that.

Regards,
Ricky


--
You received this message because you are subscribed to the Google Groups "UFFS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uffs+uns...@googlegroups.com.
To post to this group, send email to uf...@googlegroups.com.
Visit this group at http://groups.google.com/group/uffs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages